package org.esti.service;

import org.esti.model.User;

import java.util.Date;

/**
 * @author Artem Loginov (logart)
 */

/**
 * Provide access to user and all action on it.
 */
public interface UserService {
    /**
     * create user and store it in db
     *
     * @param user which will be created in the system
     * @return already created user
     */
    User createUser(User user);

    /**
     * Check if user already exist.
     * User already exist if user from parameter and any of existed users have same login.
     *
     * @param user which we want to check if it already exist
     * @return true if user exist and false in other way
     */
    boolean isUserExist(User user);

    /**
     * retrieve user using login
     *
     * @param login of user which we want to retrieve
     * @return user with specified login
     */
    User getUserByLogin(String login);

    /**
     * update specified in parameters user field
     *
     * @param login      of user which will be updated
     * @param name       new user name
     * @param middleName new middle name
     * @param surname    new surname
     * @param birthday   new date of birthday
     * @return a;ready updated user
     */
    User updateUser(
            String login,
            String name,
            String middleName,
            String surname,
            Date birthday);
}
